Remove --cap-lints feature detection (fix issue #3828)
authortee-too <tee-too@users.noreply.github.com>
Fri, 17 Mar 2017 13:52:31 +0000 (14:52 +0100)
committertee-too <tee-too@users.noreply.github.com>
Fri, 17 Mar 2017 13:52:31 +0000 (14:52 +0100)
src/cargo/ops/cargo_rustc/mod.rs
src/cargo/util/rustc.rs
tests/git.rs

index 0cac00a9537779850965a54b588836d3b68c91ac..2ebbb19620047863c871d2fd3fcd93cb8c8cb61b 100644 (file)
@@ -253,20 +253,12 @@ fn rustc(cx: &mut Context, unit: &Unit, exec: Arc<Executor>) -> CargoResult<Work
     // If this is an upstream dep we don't want warnings from, turn off all
     // lints.
     if !cx.show_warnings(unit.pkg.package_id()) {
-        if cx.config.rustc()?.cap_lints {
-            rustc.arg("--cap-lints").arg("allow");
-        } else {
-            rustc.arg("-Awarnings");
-        }
+        rustc.arg("--cap-lints").arg("allow");
 
     // If this is an upstream dep but we *do* want warnings, make sure that they
     // don't fail compilation.
     } else if !unit.pkg.package_id().source_id().is_path() {
-        if cx.config.rustc()?.cap_lints {
-            rustc.arg("--cap-lints").arg("warn");
-        } else {
-            rustc.arg("-Awarnings"); // not much to do on older compilers
-        }
+        rustc.arg("--cap-lints").arg("warn");
     }
 
     let filenames = cx.target_filenames(unit)?;
index 954f6d88d9599d97b23d156308f9b01fe56e9db0..5bf2e74f3e0a889093310d348278aa19a2542b75 100644 (file)
@@ -6,8 +6,6 @@ pub struct Rustc {
     pub path: PathBuf,
     pub verbose_version: String,
     pub host: String,
-    /// Backwards compatibility: does this compiler support `--cap-lints` flag?
-    pub cap_lints: bool,
 }
 
 impl Rustc {
@@ -19,15 +17,9 @@ impl Rustc {
     pub fn new(path: PathBuf) -> CargoResult<Rustc> {
         let mut cmd = util::process(&path);
         cmd.arg("-vV");
-
-        let mut first = cmd.clone();
-        first.arg("--cap-lints").arg("allow");
-
-        let (cap_lints, output) = match first.exec_with_output() {
-            Ok(output) => (true, output),
-            Err(..) => (false, cmd.exec_with_output()?),
-        };
-
+        
+        let output = cmd.exec_with_output()?;
+        
         let verbose_version = String::from_utf8(output.stdout).map_err(|_| {
             internal("rustc -v didn't return utf8 output")
         })?;
@@ -46,7 +38,6 @@ impl Rustc {
             path: path,
             verbose_version: verbose_version,
             host: host,
-            cap_lints: cap_lints,
         })
     }
 
index 29b100ed8eeaf9b0776b266cf93d3c75db103101..70dd4e4b895b3a734fcc0b6a8cd57271eb0f1ff9 100644 (file)
@@ -8,7 +8,7 @@ use std::io::prelude::*;
 use std::path::Path;
 
 use cargo::util::process;
-use cargotest::{sleep_ms, RUSTC};
+use cargotest::sleep_ms;
 use cargotest::support::paths::{self, CargoPathExt};
 use cargotest::support::{git, project, execs, main_file, path2url};
 use hamcrest::{assert_that,existing_file};
@@ -1743,9 +1743,6 @@ fn lints_are_suppressed() {
 
 #[test]
 fn denied_lints_are_allowed() {
-    let enabled = RUSTC.with(|r| r.cap_lints);
-    if !enabled { return }
-
     let a = git::new("a", |p| {
         p.file("Cargo.toml", r#"
             [project]